<?php
class ModulePaymentOrderModel extends SzMySqlModel
{

    /**
     * @see SzAbstractModel::$ORM_NAME
     * @var string
     */
    public static $ORM_NAME = 'ModulePaymentOrder';

    /**
     * Initialize the ModulePaymentOrderModel.
     *
     * @return ModulePaymentOrderModel
     */
    public function __construct()
    {
        $moduleAppConfig = SzConfig::get()->loadAppConfig("module_payment/app", null, false, false);

        $this->table = 'module_payment_order';
        $this->columns = array('orderId', 'userId', 'platformToken', 'paymentDefId', 'orderTime', 'completeTime', 'status', 'extra', 'price', );
        $this->autoIncrColumn = 0;
        $this->diffUpColumns = array();
        $this->updateFilter = array(0, 1, );
        $this->toArrayFilter = array();
        $this->searchColumns = array(1, 0, );
        $this->updateColumns = array(0, );
        $this->jsonColumns = array(7, );
        $this->cacheColumn = 1;
        $this->shardColumn = null;
        $this->pkColumn = 0;
        $this->deleteColumns = array(0, );
        $this->tableShardCount = defined("MODULE_PAYMENT_ORDER_TABLE_SHARD_COLUMN") ? MODULE_PAYMENT_ORDER_TABLE_SHARD_COLUMN : null;
        $this->cacheTime = 86400;

        $this->ormName = 'ModulePaymentOrder';
        $this->columnCount = 9;
        $this->isList = true;
        $this->dbType = 'MySql';
        $this->voClassName = 'ModulePaymentOrderVo';
        $this->voListClassName = 'ModulePaymentOrderVoList';

        parent::__construct();
    }

    /**
     * Prepare SzAbstractDb & SzDbQueryBuilder.
     *
     * @param string $shardKey
     * @return array
     * <pre>
     * array(
     *     SzAbstractDb,
     *     SzDbQueryBuilder
     * )
     * </pre>
     */
    protected function prepareQueryHandles($shardKey)
    {
        $dbHandle = null;
        $queryBuilder = null;

        $dbHandle = $this->context->getPaymentDb();
        $queryBuilder = $this->context->getQueryBuilder();

        return array($dbHandle, $queryBuilder);
    }
}